package lesson14;

public class CarDemo {

	public static void main(String[] args) {
		Car firstCar = new Car();
		Car secondCar = new Car();
		Person ivan = new Person();
		Person gosho = new Person();
		ivan.name = "Ivan";
		ivan.age = 24;
		gosho.name = "Gosho";
		gosho.age = 22;
		secondCar.owner = gosho;
		firstCar.model="BMW";
		firstCar.color="Blue";
		firstCar.maxSpeed=260;
		firstCar.currentSpeed = 120;
		firstCar.currentGear=4;
		firstCar.owner = ivan;
		
		secondCar.model="Mercedes";
		secondCar.color="Black";
		secondCar.maxSpeed=260;
		secondCar.currentSpeed = 140;
		secondCar.currentGear=4;		
		
		System.out.println(firstCar.model);
		System.out.println(firstCar.maxSpeed);
		System.out.println(firstCar.color);
		System.out.println(firstCar.currentSpeed);
		System.out.println(firstCar.currentGear);
		
		System.out.println(secondCar.model);
		System.out.println(secondCar.maxSpeed);
		System.out.println(secondCar.color);
		System.out.println(secondCar.currentSpeed);
		System.out.println(secondCar.currentGear);
		firstCar.currentSpeed+=30;
		firstCar.currentGear++;
		secondCar.currentSpeed+=30;
		secondCar.currentGear++;
		System.out.println(firstCar.currentSpeed);
		System.out.println(firstCar.currentGear);
		System.out.println(secondCar.currentSpeed);
		System.out.println(secondCar.currentGear);
		System.out.println(firstCar.owner.name+" is owner of "+ firstCar.model + " and he is "+ firstCar.owner.age + " age old");
		System.out.println(secondCar.owner.name+" is owner of "+ secondCar.model + " and he is "+ secondCar.owner.age + " age old");
		
		firstCar.accelerate(40);
		firstCar.changeGear((byte)4);
	}

}
